{% extends "layouts/application.html" %}
{% block content %}

<script type="text/javascript">
function pageselectCallback(page_id, jq){
	//alert(page_id)
	window.location.href="?page="+(page_id+1);
}
$(document).ready(function(){
	// Create pagination element
    $("#Pagination").pagination({{objects.paginator.count}}, {
		num_edge_entries: 2,
		num_display_entries: 8,
		current_page:({{objects.number}}-1),
        callback: pageselectCallback
    });
});
function check_select_one(title_id, cbs_name){
    if(document.getElementById(title_id).checked){
        alert("请选择其中的一条记录");
        return false;
    }
    var row_cbs = document.getElementsByName(cbs_name);
    var checked_number = 0;
    var check_id;
    for(var i = 0; i < row_cbs.length; i++){
        if(row_cbs[i].checked){
			check_id = row_cbs[i].value;
            checked_number += 1;
            if(checked_number > 1){
                alert("请选择其中的一条记录");
                return false;
            }
        }
    }
    if(checked_number == 0){
        alert("请选择其中的一条记录");
        return false;
    }
    location.href='/{%site_root%}/manage/edit_dictionary/'+check_id
}
</script>
<div align="center">
  <div class="boxright">
    <div class="bltop2">
      <div align="left">&nbsp;&nbsp;&nbsp;
        <strong>
          &nbsp;&nbsp;&nbsp;当前位置：&nbsp;&nbsp;
          <a href="/{%site_root%}/manage/index/">后台管理</a>&nbsp;&nbsp;
          <img src="/site_media/images/zd_arrow.gif">&nbsp;&nbsp;
          <a href="/{%site_root%}/manage/resource_sel/">资源管理</a>&nbsp;&nbsp;
          <img src="/site_media/images/zd_arrow.gif">&nbsp;&nbsp;
          <a href="#">参数设置</a>
        </strong>
      </div>
    </div>
    <div class="rep_left_height">
        <TABLE cellSpacing=0 cellPadding=4 width="100%" border=0>
          <TBODY>
            <TR vAlign=top  ALIGN="left">
              <TD width="74%">
              <INPUT class=button onMouseOver="this.className='button2'" onMouseOut="this.className='button'" onclick="window.location.href='/{%site_root%}/manage/new_dictionary'" type=button value="参数添加" name=button2323>
              <!--
              <INPUT class=button onMouseOver="this.className='button2'" onMouseOut="this.className='button'" onclick=showContent() type=button value="主目录设置" name=button2323>
              -->
            </TR>
          </TBODY>
        </TABLE>


 <table id="contentSearch" style="DISPLAY: none" cellSpacing=0 cellPadding=4 width="100%" border="0">
  <TR>
    <TD class=rtdp height=22 ALIGN="left"><STRONG>修改主目录</STRONG></TD>
    <TD class=rtdp align="right" COLSPAN="3"><LABEL style="CURSOR: pointer" onclick="hideContent()">关闭</LABEL></TD>
  </TR>
  <tr>
    <td>
      <form name="form1" action="../update_root/" method="post">
        <TABLE   cellSpacing=0 cellPadding=1 width="100%" border=0>
          <input type="hidden" name="authenticity_token" value="009b397baf6eee1d899e754527dd08a20f496027">
          <TBODY>
            <TR>
              <TD class=rtdp height=22 width="30%" ALIGN="left" COLSPAN="4">
                <font color="red">
                  注：更改了主目录地址后，所有上传文件都将保存在该目录下，请在更改前确认该目录存在。<br/>
                  在windows下，地址应当这样填写：c:/file
                </font>
              </TD>

            </TR>
            <TR>
              <TD class=rtdp height=22 width="30%" ALIGN="left"><STRONG>主目录地址</STRONG></TD>
              <TD class=rtdp align="right" >
                <input id="dictionary_con_type" name="dictionary[con_type]" type="hidden" value="root" />
                <input class="text" id="main_content" name="name" size="30" value="{{root.name}}" style="WIDTH: 230px" type="text" />
              </TD>
              <TD class=rtdp width="48%" ALIGN="left" COLSPAN="2">
                <INPUT onclick="return funConfirm1();" onMouseOver="this.className='submit2'" onMouseOut="this.className='submit'" class=submit id="" type=submit value="修改" name="">
              </TD>
            </TR>
          </TBODY>
        </TABLE>
      </form>

    </td>
    <td colspan="3">&nbsp;</td>
  </tr>
</table>


        <form action="" method="post">
          <TABLE class=tatop7px cellSpacing=0 cellPadding=4 width="100%" border=0>
            <TBODY>
              <TR>
                <TD class=rtdw width="4%">
                <INPUT id="chkAll" onclick="title_check('chkAll', 'chkID')"  type=checkbox value=checkbox></TD>
                <TD class=rep_li_c width="20%" ALIGN="left"><STRONG>内容</STRONG></TD>
                <TD class=rep_li_c width="30%" ALIGN="left"><STRONG>类别</STRONG></TD>
                <TD class=rep_li_c width="250%" ALIGN="left"><STRONG>备注</STRONG></TD>
              </TR>
              {% if objects.object_list %}
              {% for dict in objects.object_list %}
                <TR id="tr_{{dict.id}}" style="TEXT-DECORATION: none" onMouseOver="this.style.backgroundColor='#EFF8FF'" onmouseout="this.style.backgroundColor=''">
                  <TD class=rtdw2>
                  <INPUT oonclick="rows_check('chkAll', 'chkID')" type=checkbox value="{{dict.id}}" name="chkID"></TD>
                  <TD class=rep_li_td_bt ALIGN="left" >
                    &nbsp;{{dict.name}}
                  </TD>
                  <TD class=rep_li_td_bt ALIGN="left">&nbsp;{{dict.type}}</TD>
                  <TD class=rep_li_td_bt ALIGN="left">&nbsp;{{dict.memo}}</TD>
                </TR>
              {% endfor %}
              {% endif %}
            </TBODY>
          </TABLE>
          <div id="Pagination" class="pagination" style="margin-right:50px;"></div>
          <TABLE cellSpacing=0 cellPadding=4 width="100%" border=0>
            <TBODY>
              <TR vAlign=top>
              <TR vAlign=top ALIGN="left">
                <TD>
                  <INPUT name="button" class="button" id="edit" type="button" value="编辑" onclick="return check_select_one('chkAll', 'chkID')">
                  <INPUT name="button" class="button" id="delete" type="submit" value="删除" onclick="return check_select('chkID')">
                </TD>
              </TR>
            </TBODY>
          </TABLE>
        </form>
      </div>

    <SCRIPT type="text/javascript">
        function showContent(){
            $("#contentSearch").show();
        }
        function hideContent(){
            $("#contentSearch").hide();
        }
    </SCRIPT>
  </div>
</div>
{% endblock %}
